![]() |
WOLF core
WOLF: A Modular Estimation Framework for Robotics
|
Solver manager for WOLF. More...
#include <core/solver/solver_manager.h>
Public Types | |
| enum class | CovarianceBlocksToBeComputed : std::size_t { ALL = 0 , ALL_MARGINALS = 1 , ROBOT_LANDMARKS = 2 , GAUSS = 3 , GAUSS_TUCAN = 4 , GAUSS_TUCAN_ONLY_POSITION = 5 } |
| Enumeration of covariance blocks to be computed. More... | |
| enum class | ReportVerbosity : std::size_t { QUIET = 0 , BRIEF = 1 , FULL = 2 } |
| Enumeration for the verbosity of the solver report. More... | |
Public Member Functions | |
| void | printProfiling (std::ostream &stream=std::cout) const |
| Prints the profiling of the solver manager (and of the derived solver) More... | |
| const ProfilingUnit & | getProfilingTotal () const |
| Returns the profiling of solve(): update problem, solve and update state. More... | |
| const ProfilingUnit & | getProfilingSolve () const |
| Returns the profiling of the solving. More... | |
| const ProfilingUnit & | getProfilingUpdate () const |
| Returns the profiling of the problem update. More... | |
| const ProfilingUnit & | getProfilingState () const |
| Returns the profiling of the state update. More... | |
| const ProfilingUnit & | getProfilingCov () const |
| Returns the profiling of the covariances computation. More... | |
| SolverManager (const ProblemPtr &_problem) | |
| Constructor with default params_. More... | |
| SolverManager (const ProblemPtr &_problem, const YAML::Node &_params) | |
| Constructor with given params_. More... | |
| virtual | ~SolverManager () |
| Destructor. More... | |
| std::string | solve () |
| Solves with the verbosity defined in params_. More... | |
| std::string | solve (const ReportVerbosity report_level) |
| Solves with a given verbosity. More... | |
| virtual bool | computeCovariances () final |
| Computes the covariances of the blocks specified in the parameters. Returns whether it succeeded. More... | |
| virtual bool | computeCovariances (const CovarianceBlocksToBeComputed blocks) final |
| Computes the covariances of the specified blocks. Returns whether it succeeded. More... | |
| virtual bool | computeCovariances (const std::vector< StateBlockPtr > &st_list) final |
| Computes the covariances (and cross-covariances) of a list of state blocks. Returns whether it succeeded. More... | |
| virtual void | update () |
| Updates solver's problem according to the wolf_problem. More... | |
| ProblemPtr | getProblem () |
| Returns the wolf problem. More... | |
| YAML::Node | getParams () const |
| Returns a copy of the YAML parameters. More... | |
| bool | getComputeCov () const |
| Returns whether the covariances are computed in the solver loop. More... | |
| double | getPeriod () const |
| Returns the period of the solver loop. More... | |
| double | getCovPeriod () const |
| Returns the period of the covariances computation in the solver loop. More... | |
| ReportVerbosity | getVerbosity () const |
| Returns the verbosity of the solver report. More... | |
| virtual bool | isStateBlockRegistered (const StateBlockPtr &state_ptr) const final |
| Returns whether a state block is registered in the solver. More... | |
| virtual bool | isStateBlockFloating (const StateBlockPtr &state_ptr) const final |
| Returns whether a state block is floating: not involved in any factor, so kept out of the solver. More... | |
| virtual bool | isStateBlockFixed (const StateBlockPtr &st) const final |
| Returns whether a registered state block is fixed in the solver. More... | |
| virtual bool | isFactorRegistered (const FactorBasePtr &fac_ptr) const final |
| Returns whether a factor is registered in the solver. More... | |
| virtual bool | hasThisLocalParametrization (const StateBlockPtr &st, const LocalParametrizationBasePtr &local_param) const final |
| Returns whether a state block has a given local parametrization in the solver. More... | |
| virtual bool | hasLocalParametrization (const StateBlockPtr &st) const final |
| Returns whether a state block has a local parametrization in the solver. More... | |
| virtual int | numFactors () const final |
| Returns the number of registered factors. More... | |
| virtual int | sizeFactors () const final |
| Returns the total residual size of the registered factors. More... | |
| virtual int | numStateBlocks () const final |
| Returns the number of state blocks (registered and floating) More... | |
| virtual int | sizeStateBlocks () const final |
| Returns the total size of the state blocks (registered and floating) More... | |
| virtual int | numStateBlocksEstimated () const final |
| Returns the number of estimated state blocks: registered and not fixed. More... | |
| virtual int | sizeStateBlocksEstimated () const final |
| Returns the total size of the estimated state blocks: registered and not fixed. More... | |
| virtual int | numFactorsDerived () const =0 |
| Returns the number of factors in the derived solver. More... | |
| virtual int | sizeFactorsDerived () const =0 |
| Returns the total residual size of the factors in the derived solver. More... | |
| virtual int | numStateBlocksEstimatedDerived () const =0 |
| Returns the number of estimated state blocks in the derived solver. More... | |
| virtual int | sizeStateBlocksEstimatedDerived () const =0 |
| Returns the total size of the estimated state blocks in the derived solver. More... | |
| virtual bool | check (std::string prefix="") const final |
| Checks the consistency of the solver manager and of the derived solver. More... | |
| virtual bool | converged () const =0 |
| Returns whether the last solve converged. More... | |
| virtual bool | failed () const =0 |
| Returns whether the last solve failed. More... | |
| virtual bool | wasStopped () const =0 |
| Returns whether the last solve was stopped (interrupted by a problem change) More... | |
| virtual unsigned int | iterations () const =0 |
| Returns the number of iterations of the last solve. More... | |
| virtual double | initialCost () const =0 |
| Returns the initial cost of the last solve. More... | |
| virtual double | finalCost () const =0 |
| Returns the final cost of the last solve. More... | |
| virtual double | totalTime () const =0 |
| Returns the total time of the last solve. More... | |
| virtual void | run () final |
| Runs the solver loop in a separate thread. More... | |
| virtual void | stop () final |
| Stops the solver loop and joins its thread. More... | |
Static Public Member Functions | |
| static SolverManagerPtr | autoSetup (const ProblemPtr &_problem, const std::string &_input_yaml_file, std::vector< std::string > _primary_schema_folders, bool _skip_yaml_validation=false) |
| Creates a solver from a YAML file (see the YAML node version) More... | |
| static SolverManagerPtr | autoSetup (const ProblemPtr &_problem, YAML::Node _param_node, std::vector< std::string > _primary_schema_folders, bool _skip_yaml_validation=false) |
| Creates a solver from a YAML node (or its 'solver' key), validated against the schemas unless skipped. More... | |
Protected Member Functions | |
| virtual Eigen::VectorXd & | getAssociatedMemBlock (const StateBlockPtr &state_ptr) |
| Returns the state vector of a registered state block used by the solver. More... | |
| const double * | getAssociatedMemBlockPtr (const StateBlockPtr &state_ptr) const |
| Returns a pointer to the state vector of a registered state block used by the solver. More... | |
| double * | getAssociatedMemBlockPtr (const StateBlockPtr &state_ptr) |
| Returns a pointer to the state vector of a registered state block used by the solver. More... | |
| virtual std::string | solveDerived (const ReportVerbosity report_level)=0 |
| Solves the problem in the derived solver, returning the report. More... | |
| virtual bool | computeCovariancesDerived (const CovarianceBlocksToBeComputed blocks)=0 |
| Computes the covariances of the specified blocks in the derived solver. More... | |
| virtual bool | computeCovariancesDerived (const std::vector< StateBlockPtr > &st_list)=0 |
| Computes the covariances of a list of state blocks in the derived solver. More... | |
| virtual void | addFactorDerived (const FactorBasePtr &fac_ptr)=0 |
| Adds a factor to the derived solver. More... | |
| virtual void | removeFactorDerived (const FactorBasePtr &fac_ptr)=0 |
| Removes a factor from the derived solver. More... | |
| virtual void | addStateBlockDerived (const StateBlockPtr &state_ptr)=0 |
| Adds a state block to the derived solver. More... | |
| virtual void | removeStateBlockDerived (const StateBlockPtr &state_ptr)=0 |
| Removes a state block from the derived solver. More... | |
| virtual void | updateStateBlockStatusDerived (const StateBlockPtr &state_ptr)=0 |
| Updates the fixed/unfixed status of a state block in the derived solver. More... | |
| virtual void | updateStateBlockLocalParametrizationDerived (const StateBlockPtr &state_ptr)=0 |
| Updates the local parametrization of a state block in the derived solver. More... | |
| virtual bool | isStateBlockRegisteredDerived (const StateBlockPtr &state_ptr) const =0 |
| Returns whether a state block is in the derived solver. More... | |
| virtual bool | isFactorRegisteredDerived (const FactorBasePtr &fac_ptr) const =0 |
| Returns whether a factor is in the derived solver. More... | |
| virtual bool | isStateBlockFixedDerived (const StateBlockPtr &st) const =0 |
| Returns whether a state block is fixed in the derived solver. More... | |
| virtual bool | hasLocalParametrizationDerived (const StateBlockPtr &st) const =0 |
| Returns whether a state block has a local parametrization in the derived solver. More... | |
| virtual bool | hasThisLocalParametrizationDerived (const StateBlockPtr &st, const LocalParametrizationBasePtr &local_param) const =0 |
| Returns whether a state block has a given local parametrization in the derived solver. More... | |
| virtual void | printProfilingDerived (std::ostream &stream=std::cout) const =0 |
| Prints the profiling of the derived solver. More... | |
| virtual bool | checkDerived (std::string prefix="") const =0 |
| Checks the consistency of the derived solver. More... | |
Protected Attributes | |
| ProblemPtr | wolf_problem_ |
| Wolf problem. More... | |
| ProfilingUnit | profiling_total_ |
| Profiling units of solve(), solving, problem update, state update and covariances computation. More... | |
| ProfilingUnit | profiling_solve_ |
| Solving. More... | |
| ProfilingUnit | profiling_update_ |
| Problem update. More... | |
| ProfilingUnit | profiling_state_ |
| State update. More... | |
| ProfilingUnit | profiling_cov_ |
| Covariances computation. More... | |
| YAML::Node | params_ |
| YAML parameters. More... | |
| std::map< StateBlockPtr, Eigen::VectorXd > | state_blocks_ |
| Registered state blocks and solver states. More... | |
| std::map< StateBlockPtr, FactorBasePtrList > | state_blocks_2_factors_ |
| Factors of each registered state block. More... | |
| std::set< FactorBasePtr > | factors_ |
| Registered factors. More... | |
| std::set< StateBlockPtr > | floating_state_blocks_ |
| State blocks not involved in any factor. More... | |
| double | period_ |
| Period of the solver loop. More... | |
| ReportVerbosity | verbose_ |
| Verbosity of the solver report. More... | |
| bool | compute_cov_ |
| Whether the covariances are computed in the solver loop. More... | |
| CovarianceBlocksToBeComputed | cov_enum_ |
| Covariance blocks computed in the solver loop. More... | |
| double | cov_period_ |
| Period of the covariances computation in the solver loop. More... | |
| std::chrono::high_resolution_clock::time_point | last_cov_time_ |
| Time of the last covariances computation. More... | |
| bool | stopping_ |
| Whether the solver loop has to stop. More... | |
Solver manager for WOLF.
|
strong |
Enumeration of covariance blocks to be computed.
|
strong |
| wolf::SolverManager::SolverManager | ( | const ProblemPtr & | _problem | ) |
Constructor with default params_.
| wolf::SolverManager::SolverManager | ( | const ProblemPtr & | _problem, |
| const YAML::Node & | _params | ||
| ) |
Constructor with given params_.
|
virtual |
Destructor.
|
protectedpure virtual |
Adds a factor to the derived solver.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
protectedpure virtual |
Adds a state block to the derived solver.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
static |
|
static |
Creates a solver from a YAML node (or its 'solver' key), validated against the schemas unless skipped.
|
finalvirtual |
Checks the consistency of the solver manager and of the derived solver.
|
protectedpure virtual |
Checks the consistency of the derived solver.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
finalvirtual |
Computes the covariances of the blocks specified in the parameters. Returns whether it succeeded.
|
finalvirtual |
Computes the covariances of the specified blocks. Returns whether it succeeded.
|
finalvirtual |
Computes the covariances (and cross-covariances) of a list of state blocks. Returns whether it succeeded.
|
protectedpure virtual |
Computes the covariances of the specified blocks in the derived solver.
Implemented in wolf::SolverEigen, and wolf::SolverCeres.
|
protectedpure virtual |
Computes the covariances of a list of state blocks in the derived solver.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
pure virtual |
Returns whether the last solve converged.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
pure virtual |
Returns whether the last solve failed.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
pure virtual |
Returns the final cost of the last solve.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
protectedvirtual |
Returns the state vector of a registered state block used by the solver.
|
protected |
Returns a pointer to the state vector of a registered state block used by the solver.
|
protected |
Returns a pointer to the state vector of a registered state block used by the solver.
| bool wolf::SolverManager::getComputeCov | ( | ) | const |
Returns whether the covariances are computed in the solver loop.
| double wolf::SolverManager::getCovPeriod | ( | ) | const |
Returns the period of the covariances computation in the solver loop.
| YAML::Node wolf::SolverManager::getParams | ( | ) | const |
Returns a copy of the YAML parameters.
| double wolf::SolverManager::getPeriod | ( | ) | const |
Returns the period of the solver loop.
| wolf::ProblemPtr wolf::SolverManager::getProblem | ( | ) |
Returns the wolf problem.
| const ProfilingUnit & wolf::SolverManager::getProfilingCov | ( | ) | const |
Returns the profiling of the covariances computation.
| const ProfilingUnit & wolf::SolverManager::getProfilingSolve | ( | ) | const |
Returns the profiling of the solving.
| const ProfilingUnit & wolf::SolverManager::getProfilingState | ( | ) | const |
Returns the profiling of the state update.
| const ProfilingUnit & wolf::SolverManager::getProfilingTotal | ( | ) | const |
Returns the profiling of solve(): update problem, solve and update state.
| const ProfilingUnit & wolf::SolverManager::getProfilingUpdate | ( | ) | const |
Returns the profiling of the problem update.
| SolverManager::ReportVerbosity wolf::SolverManager::getVerbosity | ( | ) | const |
Returns the verbosity of the solver report.
|
finalvirtual |
Returns whether a state block has a local parametrization in the solver.
|
protectedpure virtual |
Returns whether a state block has a local parametrization in the derived solver.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
finalvirtual |
Returns whether a state block has a given local parametrization in the solver.
|
protectedpure virtual |
Returns whether a state block has a given local parametrization in the derived solver.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
pure virtual |
Returns the initial cost of the last solve.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
finalvirtual |
Returns whether a factor is registered in the solver.
|
protectedpure virtual |
Returns whether a factor is in the derived solver.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
finalvirtual |
Returns whether a registered state block is fixed in the solver.
|
protectedpure virtual |
Returns whether a state block is fixed in the derived solver.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
finalvirtual |
Returns whether a state block is floating: not involved in any factor, so kept out of the solver.
|
finalvirtual |
Returns whether a state block is registered in the solver.
|
protectedpure virtual |
Returns whether a state block is in the derived solver.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
pure virtual |
Returns the number of iterations of the last solve.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
finalvirtual |
Returns the number of registered factors.
|
pure virtual |
Returns the number of factors in the derived solver.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
finalvirtual |
Returns the number of state blocks (registered and floating)
|
finalvirtual |
Returns the number of estimated state blocks: registered and not fixed.
|
pure virtual |
Returns the number of estimated state blocks in the derived solver.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
| void wolf::SolverManager::printProfiling | ( | std::ostream & | stream = std::cout | ) | const |
Prints the profiling of the solver manager (and of the derived solver)
|
protectedpure virtual |
Prints the profiling of the derived solver.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
protectedpure virtual |
Removes a factor from the derived solver.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
protectedpure virtual |
Removes a state block from the derived solver.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
finalvirtual |
Runs the solver loop in a separate thread.
|
finalvirtual |
Returns the total residual size of the registered factors.
|
pure virtual |
Returns the total residual size of the factors in the derived solver.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
finalvirtual |
Returns the total size of the state blocks (registered and floating)
|
finalvirtual |
Returns the total size of the estimated state blocks: registered and not fixed.
|
pure virtual |
Returns the total size of the estimated state blocks in the derived solver.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
| std::string wolf::SolverManager::solve | ( | ) |
Solves with the verbosity defined in params_.
| std::string wolf::SolverManager::solve | ( | const ReportVerbosity | report_level | ) |
Solves with a given verbosity.
|
protectedpure virtual |
Solves the problem in the derived solver, returning the report.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
finalvirtual |
Stops the solver loop and joins its thread.
|
pure virtual |
Returns the total time of the last solve.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
virtual |
Updates solver's problem according to the wolf_problem.
|
protectedpure virtual |
Updates the local parametrization of a state block in the derived solver.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
protectedpure virtual |
Updates the fixed/unfixed status of a state block in the derived solver.
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
pure virtual |
Returns whether the last solve was stopped (interrupted by a problem change)
Implemented in wolf::SolverCeres, and wolf::SolverEigen.
|
protected |
Whether the covariances are computed in the solver loop.
|
protected |
Covariance blocks computed in the solver loop.
|
protected |
Period of the covariances computation in the solver loop.
|
protected |
Registered factors.
|
protected |
State blocks not involved in any factor.
|
protected |
Time of the last covariances computation.
|
protected |
YAML parameters.
|
protected |
Period of the solver loop.
|
protected |
Covariances computation.
|
protected |
Solving.
|
protected |
State update.
|
protected |
|
protected |
Problem update.
|
protected |
Registered state blocks and solver states.
|
protected |
Factors of each registered state block.
|
protected |
Whether the solver loop has to stop.
|
protected |
Verbosity of the solver report.
|
protected |
Wolf problem.